<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head>
<title>LinkExchanger ADMIN AREA</title>
</head>


<?
error_reporting(0);
include_once '../global-includes.php';
include_once "menu.php";

echo "<body bgcolor=$bgcolor>";


$open = "[";
$close = "]";

if ($_GET[search]) {
	$get_url = trim ($_GET[search]);
	$get_url = '\'%'.$get_url.'%\'';
	$condition ="url LIKE $get_url";
	$all = BaseDbService::get_count('base',$condition);
	}
else 
$all = BaseDbService::get_count('base');

if(empty($_GET['page'])) {$_GET['page'] = 0;}
$begin = $_GET['page']*$onpageadmin;
$pages = $all / $onpageadmin;
?>

<!--Посторінковий висновід бази-->

<center><table cellpadding=3 width=500 border=0>
<tr>
	<td colspan=10>
		<font face="Verdana, Arial" size="4" color="green">
			<b>Перевірка, редагування, видалення посилань</b>
		</font>
		<hr size=1>
	</td>
</tr>

<!-- Displays pages -->
<?php
if ($all==0) {
	echo "<tr><td align=left colspan=9><font face=$font_face color=$font_color size=$font_size>Нема посилань";
	exit;
}
else echo "<tr><td align=left colspan=9><font face=$font_face color=$font_color size=$font_size>Посилань: $all || Сторінки: ";
for ($p=0;$p<$pages;$p++) { // генеруємо номери сторінок
$pg = $p+1;
if($_GET['page']==$p) {
echo $open.$pg.$close;
} else {
echo $open."<a href=$_SERVER[PHP_SELF]?page=".$p."&sort=$_GET[sort]&column=$_GET[column]&search=$_GET[search]>".$pg."</a>".$close;
}
}
?>

	</font><hr size=1></td></tr>
<!-- Displays pages -->

<!-- Displays cap table -->
<tr>
	<td align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Nick<b/><br>
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=asc&column=nick><img src=images/up.gif width=10 height=10 border=0></a> 
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=desc&column=nick><img src=images/down.gif width=10 height=10 border=0></a>
		</font>
	</td>
	<td align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Кнопка<b/>
		</font>
	</td>
	<td align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Категорія</b><br>
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=asc&column=category><img src=images/up.gif width=10 height=10 border=0></a> 
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=desc&column=category><img src=images/down.gif width=10 height=10 border=0></a>
		</font>
	</td>
	<td nowrap align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Перевірена</b><br>
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=asc&column=check_date><img src=images/up.gif width=10 height=10 border=0></a> 
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=desc&column=check_date><img src=images/down.gif width=10 height=10 border=0></a>
		</font>
	</td>
	<td align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Результат</b><br>
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=asc&column=check_result><img src=images/up.gif width=10 height=10 border=0></a>
				<a href=<?php $_SERVER[PHP_SELF]?>?sort=desc&column=check_result><img src=images/down.gif width=10 height=10 border=0></a>
		</font>
	</td>
	<td colspan=4 align=center valign=top>
		<font face="Verdana, Arial" color="black" size="2">
			<b>Дії<b/>
		</font>
	</td>
</tr>
<tr>
	<td colspan=9 align=center>
		<hr size=1>
	</td>
</tr>     
<!-- Displays cap table -->



<!-- Displays links -->
<?php   
$get_url = '\'%' . trim ($_GET[search]) . '%\'';          
$sql = "select  id, nick, category, htmltext, htmlimage, urllink, check_result, check_date FROM base";
$sql .=  ($_GET[search]) ? " WHERE url LIKE $get_url " : " ";
$sql .= "LIMIT $begin,$onpageadmin";
$record = BaseDbService::execute_select_query($sql);


for($i = 0; $i < count($record); $i++)
{
$fc = ($record[$i][check_result] == NO) ? $wrn_color : $font_color;
$date=import_datetime($record[$i][check_date]);
	$content = "<tr><td align=left valign=top><font face=$font_face color=$fc size=$font_size>".$record[$i][nick]."</font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$font_color size=$font_size>".$record[$i][htmlimage]."</font></td>\n";
	$content .=  "\t\t<td align=left valign=top><font face=$font_face color=$font_color size=$font_size>".$record[$i][category]."</font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$fc size=$font_size>$date</font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$fc size=$font_size>".$record[$i][check_result]."</font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$font_color size=$font_size><a href=multicheck.php?id=".$record[$i][id].">Перевірити</a></font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$font_color size=$font_size><a href=".$record[$i][urllink]." target=_blank>Переглянути</a></font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$font_color size=$font_size><a href=edit.php?id=".$record[$i][id].">Редагувати</a></font></td>\n";
	$content .=  "\t\t<td align=center valign=top><font face=$font_face color=$font_color size=$font_size><a href=delete.php?id=".$record[$i][id].">Видалити</a></font></td></tr>\n";
	$content .=  "\t\t<tr><td align=left valign=top colspan=9><font face=$font_face color=$font_color size=$font_size><i>".$record[$i][htmltext]."</i></font></td></tr>\n";
	$content .=  "<tr><td colspan=9><hr size=1></td></tr>\n";
	echo $content;
}
?>

<tr>
	<td colspan=9>
		<center>
			<table>
				<tr>
					<td colspan=2>
					
						<hr size=1>
					</td>
				</tr>
			</table>
		</center>
	</td>
</tr>
</table>
<!-- Displays links -->

</body>
</html>
